<!-- SFTP 文件管理模态框（partial） -->
<div class="modal fade" id="sftpModal" tabindex="-1" aria-labelledby="sftpModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-xl">
    <div class="modal-content">
      <div class="modal-header bg-secondary text-white">
        <h5 class="modal-title" id="sftpModalLabel">
          <i class="fa fa-folder-open mr-2"></i>SFTP 文件管理
        </h5>
        <button type="button" class="btn-sm btn-light ms-2" id="sftp-refresh-btn" title="刷新"><i class="fa fa-refresh"></i></button>
        <button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="关闭"></button>
      </div>
      <div class="modal-body">
        <!-- 工具栏 -->
        <div class="d-flex align-items-center mb-2 flex-wrap gap-2">
          <button class="btn btn-sm btn-primary" id="sftp-upload-btn"><i class="fa fa-upload me-1"></i>上传</button>
          <button class="btn btn-sm btn-success" id="sftp-download-btn" disabled><i class="fa fa-download me-1"></i>下载</button>
          <button class="btn btn-sm btn-warning" id="sftp-rename-btn" disabled><i class="fa fa-pencil me-1"></i>重命名</button>
          <button class="btn btn-sm btn-danger" id="sftp-delete-btn" disabled><i class="fa fa-trash me-1"></i>删除</button>
          <input type="file" id="sftp-upload-input" class="d-none" />
          <div class="ms-auto small text-muted">当前路径：<span id="sftp-current-path">/</span></div>
        </div>

        <div class="row g-3">
          <!-- 左侧树形文件列表 -->
          <div class="col-md-5">
            <div class="card h-100">
              <div class="card-header bg-light">
                <div class="d-flex align-items-center justify-content-between">
                  <span class="small"><i class="fa fa-sitemap me-1"></i>文件列表</span>
                  <div>
                    <button class="btn btn-sm btn-outline-secondary" id="sftp-go-up-btn" title="上级目录"><i class="fa fa-level-up"></i></button>
                  </div>
                </div>
              </div>
              <div class="card-body" style="height: 420px; overflow:auto;">
                <!-- zTree 容器（如未引入zTree则使用内置渲染） -->
                <ul id="sftp-tree" class="list-group"></ul>
              </div>
            </div>
          </div>

          <!-- 右侧预览/详情 -->
          <div class="col-md-7">
            <div class="card h-100">
              <div class="card-header bg-light">
                <span class="small"><i class="fa fa-file-text-o me-1"></i>预览/详情</span>
              </div>
              <div class="card-body" style="height: 420px; overflow:auto;">
                <div id="sftp-preview-empty" class="text-center text-muted p-3">
                  <i class="fa fa-file-o fa-2x mb-2"></i>
                  <div>选择文件以预览文本内容，或双击目录进入</div>
                </div>
                <pre id="sftp-preview" class="d-none" style="white-space: pre-wrap;"></pre>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
      </div>
    </div>
  </div>
</div>